#ifndef LINE_H
#define LINE_H

#include <Clarity/Math/Random.h>
#include <Clarity/Rendering/Scenemanager.h>
#include <Clarity/Math/Random.h>
#include <Clarity/Math/Math.h>
#include <Clarity/Math/Direction.h>
#include <Clarity/Math/Ray2.h>
#include <Clarity/Math/LineSegment2.h>
#include <Clarity/Math/Circle.h>
#include <Clarity/Rendering/SceneNode.h>
#include <Clarity/Renderable/Sprite.h>
#include <Clarity/Renderable/RenderableLineSegment.h>
#include "vector"
#include "IAgent.h"


class Lines
{
public:
	Lines(Clarity::SceneManager *sm = 0);
	~Lines();
	void setSceneManager(Clarity::SceneManager *sm);
	void addLine(Clarity::Vector2 start, Clarity::Vector2 end, int red=255, int green=255, int blue=255);
	void addCircle(Clarity::Vector2 pos, float radius, int red=255, int green=255, int blue=255);
	void clear();
	
	Clarity::SceneManager *m_sceneManager;
	std::vector<Clarity::RenderableLineSegment *> m_lines;
	
};

class GridNode
{
public:
	GridNode();
	bool m_wall;
};

class Grid
{
public:
	Grid();
	~Grid();
	void setup(const AIHarness::AgentInitData &agentInitData, float gridsize);
	void render();
	Clarity::Vector2 getGridPos(int x, int y);
	void mapToGrid(Clarity::Vector2 pos, int &x, int &y);
	GridNode &getNode(int x, int y);
	int getRows();
	int getColumns();
	
	float m_gridsize;
	int m_rows;
	int m_columns;
	float x1,x2,y1,y2;
	GridNode *m_data;
	Clarity::SceneManager *m_scene;
	Lines m_lines;
};


#endif
